package com.bigmi.admin;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;


@SpringBootApplication
@EnableDiscoveryClient
@MapperScan("com.bigmi.admin.mapper")
@Slf4j
//feign远程包扫描
@EnableFeignClients(basePackages = "com.bigmi.apis")
//开启异步调用
@EnableAsync
public class AdminApplication {
    public static void main(String[] args) {
        SpringApplication.run(AdminApplication.class,args);
        log.info("管理员端服务启动");
    }
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        //创建分页拦截器对象MybatisPlusInterceptor
        MybatisPlusInterceptor mybatisPlusInterceptor=new MybatisPlusInterceptor();
        //添加分页拦截器
        mybatisPlusInterceptor.addInnerInterceptor( new PaginationInnerInterceptor() );
        return mybatisPlusInterceptor;
    }
}
